package com.hzit.payweb.api.resp;

import lombok.Data;
import lombok.ToString;

/**
 * 返回通用对象
 */
@Data
@ToString
public class RespVo <T>{

//    {
//        code : 0,
//        msg : "请求成功",
//        data:{
//                payUrl :"",
//    orderId: ""
//    }
//
//
//    }
    private int code;

    private String msg;

    private T data;

    /**
     * 封装错误的返回
     * @return
     */
    public static RespVo returnFail(int code,String msg){

        RespVo respVo = new RespVo();

        respVo.setCode(code);
        respVo.setMsg(msg);
        return respVo;
    }

    /**
     * 封装成功的返回
     * @return
     */
    public static RespVo returnSuccess(String msg){

        RespVo respVo = new RespVo();
        respVo.setCode(0);
        respVo.setMsg(msg);
        return respVo;
    }

}
